#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>

using namespace std;
int main()
{
	int i = 0;
	int n, m;
	long long k = 0, z = 0;
	scanf("%d", &n);
	for (i = 0; i < n; i++)
	{
		scanf("%d", &m);
		z += k * m;
		k += m;
	}
	printf("%lld", z);
	return 0;
}